from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_breast_cancer
import numpy as np
from python_ai.common.xcommon import sep

cancer = load_breast_cancer()
x = cancer.data
y = cancer.target

model = LogisticRegression(solver='liblinear')
model.fit(x, y)
sep('theta')
theta0 = model.intercept_
theta1n = model.coef_
print(theta0.shape, theta1n.shape)
theta = np.c_[theta0, theta1n]
print(theta)

sep('score')
print(f'score = {model.score(x, y)}')

sep('predict')
h = model.predict(x)
e = h - y
print(e)
